<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        //1.数组定义方式一
        var lst=["audi","bmw","volvo"] //java中是{}
        console.log("lst="+lst)
        console.log(lst[1])//bmw
        //2.数组定义方式二
        var lst2=[] //定义空数组
        lst2[0]="奥迪"
        lst2[1]="宝马"
        lst2[2]="奔驰"
        console.log("lst2="+lst2)
        console.log(lst2[10]) //undefined
        //3.方式三
        var lst3=new Array("audi","bmw","volvo")
        console.log("lst3="+lst3)
        //方式四
        var lst4=new Array() //空数组
        console.log(typeof lst4) //Object
        lst4[0]="奥迪"
        lst4[1]="宝马"
        lst4[3]="奔驰"
        lst4[10]="红旗"// 扩容，中间没有赋值的元素值为undefined(有的浏览器显示为空)
        console.log("lst4="+lst4)
    </script>
</head>
<body>

</body>
</html>